package com.web.managedbean;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.primefaces.context.RequestContext;
import org.primefaces.event.SelectEvent;
import org.primefaces.model.chart.LineChartModel;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.constants.Constants;
import com.database.bean.CompanyProduct;
import com.database.bean.CompanyRoundDecisionAndResult;
import com.database.bean.Game;
import com.database.bean.Product;
import com.database.bean.Report;
import com.database.bean.ReportDecision;
import com.database.bean.Round;
import com.database.bean.Setting;
import com.database.bean.User;
import com.math.util.CalculationUtil;

@ManagedBean(name="companyMBean")
@Controller
@SessionScoped
@Scope("session")
public class CompanyMBean  extends AbstractManagedBean {

	private static final long serialVersionUID = 1L;
	
	private User user=null;
	private String gameName=null;
	
	/** actual game **/
	private Game currentGame=null;
	
	/** actual configurable round **/
	private Round actRound=null;
	
	/** previous played round **/
	private Round previousRound=null;
	
	/** actual decisions to do **/
	private CompanyRoundDecisionAndResult crDecRes=null;
	
	/** previous results to show **/
	private CompanyRoundDecisionAndResult prevCrDecRes=null;
	
	/** products to choose */
	private List<Product> products = null;
	
	/** chosen products */
	private List<CompanyProduct> companyProducts = null;
	
	/** properties/values to set in mask */
	private Double marketingInvestment=null;
	private Double employerEducationInvestment=null;
	private Double rdInvestment=null;
	
	private Double prevMarketingInvestment=null;
	private Double prevEmployerEducationInvestment=null;
	private Double prevRdInvestment=null;
	
	/** selected product to add to the basket*/
	private Product selectedProduct = null;
	/** selected companyProduct to remove from the basket **/
	private CompanyProduct selectedCompanyProduct = null;
	/** selected reportDecision to remove from the basket **/
	private ReportDecision selectedRepDec = null;
	
	private List<Report> reportOptions;
	private Integer selectedReportOption;
	private List<User> competitorList;
	private Integer selectedCompetitorID;
	private Boolean spying=false;
	
	private Double startBudget = 0.0;
	
	/** graphics */
	private LineChartModel marketingInvestmentsChart;
	private LineChartModel personalInvestmentsChart;
	private LineChartModel rdInvestmentsChart;
	
	private Boolean reportDecisionTableRendered=false;
	
	private Double sellingPrice = 0.0;
	
	/** helpers */
	Double maxMarketing=10000.0;
	Double maxPersonal=10000.0;
	Double maxRD=10000.0;
	
	
	public CompanyMBean() {
		super();
	}
	
	@PostConstruct
	public void init() {
		if (this.currentGame == null) {

			FacesContext context = FacesContext.getCurrentInstance();
			HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
			HttpSession httpSession = request.getSession(false);
			this.user = (User) httpSession.getAttribute("user");
			
			this.initGame();

		}
		
	}
	
	/**
	 * 
	 */
	private void initGame(){
		if (user != null) {
			
			Setting setting = this.companyService.getSetting();
			this.startBudget = setting.getStartBudgetForCompanies();
			this.maxMarketing = setting.getMaxCostsMarketing();
			this.maxPersonal = setting.getMaxCostsPersonal();
			this.maxRD = setting.getMaxCostsRD();
			
			//reload the companyRoundDecisionAndResults
			User loadedUser=userService.reloadCompanyRoundDecisionAndResults(user);
			this.user=loadedUser;
			
			this.currentGame = user.getGame();
			if (currentGame != null) {
				
				this.gameName = this.currentGame.getName();
				this.actRound = this.currentGame.getConfigurableRound();
				
				if (this.actRound != null) {
					this.crDecRes = this.actRound
							.getDecisionsAndResultsForComp(user);
					if(this.crDecRes==null && this.actRound.getRoundNumber()==1){
						this.createNewCompanyRoundDecisionAndResult();
					}
							
					this.previousRound = this.currentGame
							.getPreviousRoundFromRound(this.actRound);
					if (this.previousRound != null) {
						this.prevCrDecRes = this.previousRound
								.getDecisionsAndResultsForComp(user);
						
					}
				}
			}
		}else{
			this.addErrorMessage(Constants.CMB_NO_USER);
		}
	}
	
	private void reInitialize(){
		if (this.currentGame == null) {

			FacesContext context = FacesContext.getCurrentInstance();
			HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
			HttpSession httpSession = request.getSession(false);
			this.user = (User) httpSession.getAttribute("user");
			
			this.initGame();

		}
	}

	
	/**
	 * Navigation to CompanyDecisions site and initialization of the fields
	 * @return
	 */
	public String navigateToCompanyDecisions(){
		
		if(this.currentGame==null){
			this.reInitialize();
		}
		
		if(this.currentGame==null){
			this.addErrorMessage(Constants.CMB_PROBLEMS);
			return "";
		}	
		
		this.competitorList=this.currentGame.getUserList();
		this.competitorList.remove(this.user);
		
		//already selected products and investment decisions
		if (this.crDecRes != null) {
			this.companyProducts = this.crDecRes
					.getCompanyProducts();
			this.marketingInvestment = crDecRes
					.getMarketingInvestment();
			this.employerEducationInvestment = crDecRes
					.getEmployerEducationInvestment();
			this.rdInvestment = crDecRes.getRdInvestment();
			
			if(this.crDecRes.getReportDecisions()!=null && this.crDecRes.getReportDecisions().size()>0){
				this.reportDecisionTableRendered=true;
			}
			
		}else{
			if(this.actRound!=null && this.actRound.getRoundNumber()==1){
				this.createNewCompanyRoundDecisionAndResult();
			}
		}
		
		//previous round taken decisions
		if(this.prevCrDecRes!=null){
			this.prevMarketingInvestment = prevCrDecRes
					.getMarketingInvestment();
			this.prevEmployerEducationInvestment = prevCrDecRes
					.getEmployerEducationInvestment();
			this.prevRdInvestment = prevCrDecRes.getRdInvestment();
		}
		
		//available products for choosing
		if(this.products == null){
			this.products = this.companyService.getAllActiveProducts();
		}
		
		//available reports to purchase
		if(this.reportOptions==null){
			reportOptions = this.companyService.getAllReports();
		}
		
		this.marketingInvestmentsChart = this.companyService.getCompanyGameMarketingInvestments(this.user);
		this.personalInvestmentsChart = this.companyService.getCompanyGameEmployerInvestments(this.user);
		this.rdInvestmentsChart = this.companyService.getCompanyGameRDInvestments(this.user);
		return "companyProductOverview?faces-redirect=true";
	}
	
	/**
	 * Creating a new companyRoundDecisionAndResult object.
	 * @return if creation was without errors
	 */
	private boolean createNewCompanyRoundDecisionAndResult(){
		if(this.actRound!=null){
			this.crDecRes = new CompanyRoundDecisionAndResult();
			
			//copy previous round
			if ((this.actRound.getRoundNumber() > 1) && (this.prevCrDecRes!=null)) {
				this.crDecRes = this.prevCrDecRes.getCopy(actRound);
			}else{
				this.crDecRes.setUser(user);
				this.crDecRes.setRound(this.actRound);
			}
			
			this.companyService.update(this.crDecRes);
			return true;
		}else{
			this.addErrorMessage(Constants.CMB_NO_ACTUAL_ROUND);
			return false;
		}
	}
	
	/**
	 * 
	 * @return
	 */
	private boolean isActRoundPlayable(){
		boolean playable=false;
		
		if(this.actRound==null){
			this.actRound = this.currentGame.getConfigurableRound();
			if(this.actRound==null){
				this.addErrorMessage(Constants.CMB_NO_ACTUAL_ROUND);
				return false;
			}
		}
		
		if (this.crDecRes == null) {
			if (this.actRound != null && this.actRound.getRoundNumber() == 1) {
				if (!this.createNewCompanyRoundDecisionAndResult()) {
					this.addErrorMessage(Constants.CMB_DECISION_UPDATE_FAIL);
					return false;
				}
			} else {
				return false;
			}
		}
		
		if(this.actRound.isRoundPlayable()){
			playable = true;
		}else{
			this.actRound = this.currentGame.getConfigurableRound();
			if(this.actRound!=null && this.actRound.isRoundPlayable()){
				playable = true;
				this.initGame();
			}else{
				this.addErrorMessage(Constants.CMB_NO_ACTUAL_ROUND);
			}
		}
		
		return playable;
	}
	
	//--------------------------Save Company decisions-------------------------
	
	/**
	 * Save the marketing decision
	 * @param actionEvent
	 */
	public void saveMarketingDecision(ActionEvent actionEvent) {

		if (this.isActRoundPlayable()) {

			this.crDecRes.setMarketingInvestment(this.marketingInvestment);
			this.companyService.update(this.crDecRes);
			this.addInfoMessage(Constants.CMB_DECISION_UPDATE);

		}
	}
	
	/**
	 * Save the MarketingAnalysisDecision
	 * @param actionEvent
	 */
	public void saveMarketAnalysisDecision(ActionEvent actionEvent) {

		if (this.isActRoundPlayable()) {
			if (this.selectedReportOption == null
					|| this.selectedReportOption == 0) {
				this.addErrorMessage("You have to choose a report option.");
			} else {

				ReportDecision repDec = new ReportDecision();
				repDec.setDecRes(this.crDecRes);

				for (Report rep : this.reportOptions) {
					if (rep.getId() == this.getSelectedReportOption()) {
						repDec.setReport(rep);
						break;
					}
				}

				if (this.spying && this.selectedCompetitorID != null) {
					for (User comp : this.competitorList) {
						if (comp.getId() == this.selectedCompetitorID) {
							repDec.setTargetCompany_Id(comp.getId());
							break;
						}
					}
				}

				this.crDecRes.addReportDecision(repDec);
				this.companyService.update(repDec);

				
				// this.companyService.update(this.crDecRes);

				if (this.crDecRes.getReportDecisions() != null
						&& this.crDecRes.getReportDecisions().size() > 0) {
					this.reportDecisionTableRendered = true;
				}

				this.addInfoMessage(Constants.CMB_DECISION_UPDATE);
			}
		}
	}
	
	/**
	 * Save the MarketingAnalysisDecision
	 * @param actionEvent
	 */
	public void saveMarketAnalysisDecisionSpying(ActionEvent actionEvent) {

		if (this.isActRoundPlayable()) {

			ReportDecision repDec = new ReportDecision();
			repDec.setDecRes(this.crDecRes);

			for (Report rep : this.reportOptions) {
				if (rep.getId() == this.getSelectedReportOption()) {
					repDec.setReport(rep);
					break;
				}
			}

			if (this.selectedCompetitorID != null) {
				for (User comp : this.competitorList) {
					if (comp.getId() == this.selectedCompetitorID) {
						repDec.setTargetCompany_Id(comp.getId());
						break;
					}
				}
			}

			this.companyService.update(repDec);

			this.crDecRes.addReportDecision(repDec);

			if (this.crDecRes.getReportDecisions() != null
					&& this.crDecRes.getReportDecisions().size() > 0) {
				this.reportDecisionTableRendered = true;
			}

			this.addInfoMessage(Constants.CMB_DECISION_UPDATE);
		}
	}
	
	/**
	 * Delete a report from a Round Decision
	 * 
	 */
	public String actionDeleteRepDec(){
		
		if (this.isActRoundPlayable()) {

			this.crDecRes.removeReportDecision(this.selectedRepDec);
			this.companyService.delete(this.selectedRepDec);
			
			if (this.crDecRes.getReportDecisions() != null) {
				if (this.crDecRes.getReportDecisions().size() < 1) {
					this.reportDecisionTableRendered = false;
				}
			} else {
				this.reportDecisionTableRendered = false;
			}

			this.addInfoMessage(Constants.CMB_REPORT_DECISION_REMOVED);
		}
		return "companyMarketAnalysis?faces-redirect=true";
	}
	
	/**
	 * Save the RD Decision
	 */
	public void saveRDDecision(ActionEvent actionEvent) {

		if (this.isActRoundPlayable()) {

			this.crDecRes.setRdInvestment(this.rdInvestment);
			this.companyService.update(this.crDecRes);
			this.addInfoMessage(Constants.CMB_DECISION_UPDATE);
		}
	}
	
	/**
	 * Save the personal decisions
	 */
	public void savePersonalDecision(ActionEvent actionEvent) {

		if (this.isActRoundPlayable()) {

			this.crDecRes
					.setEmployerEducationInvestment(this.employerEducationInvestment);
			this.companyService.update(this.crDecRes);
			this.addInfoMessage(Constants.CMB_DECISION_UPDATE);

		}
	}
	
	/**
	 * Open Setting Price Dialog
	 * @param productId
	 */
	public void setSellingPrice(Integer productId) {
		
		Product product=null;
		if(productId!=null)  {
			for(Product prod:this.getProducts()){
				if(prod.getId()==productId){
					product=prod;
				}
			}
			if (product != null) {
				this.selectedProduct = product;
				this.sellingPrice = this.selectedProduct.getProductCosts();
			}
		}
		
		Map<String,Object> options = new HashMap<String, Object>();
		options.put("modal", true);
		options.put("draggable", false);
		options.put("resizable", false);
		options.put("closable", true);
		options.put("contentHeight", 320);
		        
        RequestContext.getCurrentInstance().openDialog("companySellingPriceDialog", options, null);
    }
    
	/**
	 * Save settings from Selling Price Dialog
	 * @param event
	 */
    public void onSellingPriceSet(SelectEvent event) {
        this.actionAddCompanyProduct();
    }
    
    /**
     * Close Selling Price Dialog
     * @param actionEvent
     */
    public void saveSellingPriceDialog(ActionEvent actionEvent) {
        RequestContext.getCurrentInstance().closeDialog(null);
    }
	
	/**
	 * Add and create a new product to a Round Decision
	 */
	public String actionAddCompanyProduct(){
		
		boolean contained = false;
		
		if (this.isActRoundPlayable()) {

			for(CompanyProduct cprod:this.crDecRes.getCompanyProducts()){
				if(cprod.getProduct().getId() == this.selectedProduct.getId()){
					contained=true;
				}
			}
			
			if (!contained) {

				CompanyProduct compProduct = new CompanyProduct();
				compProduct.setProduct(this.selectedProduct);
				compProduct.setCompanyRoundDecisionAndResult(this.crDecRes);
				compProduct.setSellingPrice(this.getSellingPrice());
				
				this.companyService.update(compProduct);

				this.crDecRes.addCompanyProduct(compProduct);
				this.companyProducts = this.crDecRes.getCompanyProducts();

				this.addInfoMessage(this.selectedProduct.getName() + ": "
						+ Constants.CMB_PRODUCT_ADDED);
				
				if(compProduct.getSellingPrice()<=this.selectedProduct.getProductCosts()){
					this.addWarningMessage(Constants.CMB_ZERO_PRODUCT);
				}
				
			}else{
				this.addErrorMessage(this.selectedProduct.getName() + ": "
						+ Constants.CMB_PRODUCT_CONTAINED);
			}

		}
		
		return "";
		
	}
	
	public double getPortfolioCosts(){
		int productsAmount=0;
		if(companyProducts!=null){
			productsAmount=companyProducts.size();
		}
		
		return CalculationUtil.calculateLogisticCosts(productsAmount,companyService.getSetting());
		
	}
	
	
	/**
	 * Delete a product from a Round Decision
	 * create a new CompanyProduct Object
	 */
	public String actionDeleteCompanyProduct(){
		
		if (this.isActRoundPlayable()) {
			this.crDecRes.removeCompanyProduct(this.selectedCompanyProduct);
			this.companyService.delete(this.selectedCompanyProduct);
			this.companyProducts = this.crDecRes.getCompanyProducts();

			this.addInfoMessage(Constants.CMB_PRODUCT_REMOVED);
		}
		
		return "";
		
	}
	
	
	/**
	 * Saving and refreshing the CompanyProductList, especially to 
	 * update the selling price.
	 * @return
	 */
	public void actionSaveAndRefreshAllCompanyProducts(ActionEvent actionEvent){
		
		boolean zeroProducts = false;
		
		if (this.isActRoundPlayable()) {

			for (CompanyProduct cp : this.companyProducts) {
				if (cp.getSellingPrice() != null) {
					if (cp.getSellingPrice() == 0
							|| cp.getSellingPrice() <= cp.getProduct()
									.getProductCosts()) {
						zeroProducts = true;
					}
				}
				this.companyService.update(cp);
			}
			this.addInfoMessage(Constants.CMB_DECISION_UPDATE);
			if(zeroProducts){
				this.addWarningMessage(Constants.CMB_ZERO_PRODUCT);
			}
		}
		
	}

	
	//-----------------------------Helper Methods------------------------------

	/**
	 * Navigate to the product-detail-web-page
	 * @return
	 */
	public String actionShowProductDetail(){
		return "companyProductDetails?faces-redirect=true";
	}
	
	/**
	 * Helper function: Returns competitor name for given id
	 * @param id
	 * @return
	 */
	public String getCompetitorName(Integer id){
		String nickname="";
		for(User usr:this.getCompetitorList()){
			if(usr.getId()==id){
				nickname=usr.getNickname();
				break;
			}
		}
		return nickname;
	}
	
	/**
	 * Helper method to enable/disable the list with competitors to choose them 
	 * for a new spying report.
	 */
	public void actionSpying(){
		Boolean optionSpying=false;
		if(this.selectedReportOption!=null){
			for(Report rep:this.reportOptions){
				if(rep.getId() == this.getSelectedReportOption()){
					if(rep.isSpying()){
						optionSpying=true;
						break;
					}
				}
			}
		}
		if(optionSpying){
			this.spying=true;
		}else{
			this.spying=false;
		}
	}
	
	
	//-----------------------------Getters and Setters-------------------------
	
	/**
	 * @return the currentGame
	 */
	public Game getCurrentGame() {
		return this.currentGame;
	}

	/**
	 * @param currentGame the currentGame to set
	 */
	public void setCurrentGame(Game currentGame) {
		this.currentGame = currentGame;
	}

	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}


	/**
	 * @return the gameName
	 */
	public String getGameName() {
		return gameName;
	}


	/**
	 * @param gameName the gameName to set
	 */
	public void setGameName(String gameName) {
		this.gameName = gameName;
	}

	/**
	 * @return the actualRound
	 */
	public Round getActRound() {
		return actRound;
	}

	/**
	 * @param actRoud the actual Round to set
	 */
	public void setActRound(Round actRound) {
		this.actRound = actRound;
	}

	/**
	 * @return the products
	 */
	public List<Product> getProducts() {
		return products;
	}

	/**
	 * @param products the products to set
	 */
	public void setProducts(List<Product> products) {
		this.products = products;
	}

	/**
	 * @return the marketingInvestment
	 */
	public Double getMarketingInvestment() {
		return marketingInvestment;
	}

	/**
	 * @param marketingInvestment the marketingInvestment to set
	 */
	public void setMarketingInvestment(Double marketingInvestment) {
		this.marketingInvestment = marketingInvestment;
	}

	/**
	 * @return the employerEducationInvestment
	 */
	public Double getEmployerEducationInvestment() {
		return employerEducationInvestment;
	}

	/**
	 * @param employerEducationInvestment the employerEducationInvestment to set
	 */
	public void setEmployerEducationInvestment(Double employerEducationInvestment) {
		this.employerEducationInvestment = employerEducationInvestment;
	}

	/**
	 * @return the rdInvestment
	 */
	public Double getRdInvestment() {
		return rdInvestment;
	}

	/**
	 * @param rdInvestment the rdInvestment to set
	 */
	public void setRdInvestment(Double rdInvestment) {
		this.rdInvestment = rdInvestment;
	}

	/**
	 * @return the crDecRes
	 */
	public CompanyRoundDecisionAndResult getCrDecRes() {
		return crDecRes;
	}

	/**
	 * @param crDecRes the crDecRes to set
	 */
	public void setCrDecRes(CompanyRoundDecisionAndResult crDecRes) {
		this.crDecRes = crDecRes;
	}

	/**
	 * @return the selectedProduct
	 */
	public Product getSelectedProduct() {
		return selectedProduct;
	}

	/**
	 * @param selectedProduct the selectedProduct to set
	 */
	public void setSelectedProduct(Product selectedProduct) {
		this.selectedProduct = selectedProduct;
	}

	/**
	 * @return the companyProducts
	 */
	public List<CompanyProduct> getCompanyProducts() {
		return companyProducts;
	}

	/**
	 * @param companyProducts the companyProducts to set
	 */
	public void setCompanyProducts(List<CompanyProduct> companyProducts) {
		this.companyProducts = companyProducts;
	}

	/**
	 * @return the selectedCompanyProduct
	 */
	public CompanyProduct getSelectedCompanyProduct() {
		return selectedCompanyProduct;
	}

	/**
	 * @param selectedCompanyProduct the selectedCompanyProduct to set
	 */
	public void setSelectedCompanyProduct(CompanyProduct selectedCompanyProduct) {
		this.selectedCompanyProduct = selectedCompanyProduct;
	}

	/**
	 * @return the previousRound
	 */
	public Round getPreviousRound() {
		return previousRound;
	}

	/**
	 * @param previousRound the previousRound to set
	 */
	public void setPreviousRound(Round previousRound) {
		this.previousRound = previousRound;
	}

	/**
	 * @return the prevCrDecRes
	 */
	public CompanyRoundDecisionAndResult getPrevCrDecRes() {
		return prevCrDecRes;
	}

	/**
	 * @param prevCrDecRes the prevCrDecRes to set
	 */
	public void setPrevCrDecRes(CompanyRoundDecisionAndResult prevCrDecRes) {
		this.prevCrDecRes = prevCrDecRes;
	}

	/**
	 * @return the prevMarketingInvestment
	 */
	public Double getPrevMarketingInvestment() {
		return prevMarketingInvestment;
	}

	/**
	 * @param prevMarketingInvestment the prevMarketingInvestment to set
	 */
	public void setPrevMarketingInvestment(Double prevMarketingInvestment) {
		this.prevMarketingInvestment = prevMarketingInvestment;
	}

	/**
	 * @return the prevEmployerEducationInvestment
	 */
	public Double getPrevEmployerEducationInvestment() {
		return prevEmployerEducationInvestment;
	}

	/**
	 * @param prevEmployerEducationInvestment the prevEmployerEducationInvestment to set
	 */
	public void setPrevEmployerEducationInvestment(
			Double prevEmployerEducationInvestment) {
		this.prevEmployerEducationInvestment = prevEmployerEducationInvestment;
	}

	/**
	 * @return the prevRdInvestment
	 */
	public Double getPrevRdInvestment() {
		return prevRdInvestment;
	}

	/**
	 * @param prevRdInvestment the prevRdInvestment to set
	 */
	public void setPrevRdInvestment(Double prevRdInvestment) {
		this.prevRdInvestment = prevRdInvestment;
	}

	/**
	 * @return the reportOptions
	 */
	public List<Report> getReportOptions() {
		return reportOptions;
	}

	/**
	 * @param reportOptions the reportOptions to set
	 */
	public void setReportOptions(List<Report> reportOptions) {
		this.reportOptions = reportOptions;
	}

	/**
	 * @return the selectedReportOption
	 */
	public Integer getSelectedReportOption() {
		return selectedReportOption;
	}

	/**
	 * @param selectedReportOption the selectedReportOption to set
	 */
	public void setSelectedReportOption(Integer selectedReportOption) {
		this.selectedReportOption = selectedReportOption;
	}

	/**
	 * @return the marketingInvestmentsChart
	 */
	public LineChartModel getMarketingInvestmentsChart() {
		return marketingInvestmentsChart;
	}

	/**
	 * @param marketingInvestmentsChart the marketingInvestmentsChart to set
	 */
	public void setMarketingInvestmentsChart(
			LineChartModel marketingInvestmentsChart) {
		this.marketingInvestmentsChart = marketingInvestmentsChart;
	}

	/**
	 * @return the personalInvestmentsChart
	 */
	public LineChartModel getPersonalInvestmentsChart() {
		return personalInvestmentsChart;
	}

	/**
	 * @param personalInvestmentsChart the personalInvestmentsChart to set
	 */
	public void setPersonalInvestmentsChart(LineChartModel personalInvestmentsChart) {
		this.personalInvestmentsChart = personalInvestmentsChart;
	}

	/**
	 * @return the rdInvestmentsChart
	 */
	public LineChartModel getRdInvestmentsChart() {
		return rdInvestmentsChart;
	}

	/**
	 * @param rdInvestmentsChart the rdInvestmentsChart to set
	 */
	public void setRdInvestmentsChart(LineChartModel rdInvestmentsChart) {
		this.rdInvestmentsChart = rdInvestmentsChart;
	}

	/**
	 * @return the selectedRepDec
	 */
	public ReportDecision getSelectedRepDec() {
		return selectedRepDec;
	}

	/**
	 * @param selectedRepDec the selectedRepDec to set
	 */
	public void setSelectedRepDec(ReportDecision selectedRepDec) {
		this.selectedRepDec = selectedRepDec;
	}

	/**
	 * @return the reportDecisionTableRendered
	 */
	public Boolean getReportDecisionTableRendered() {
		return reportDecisionTableRendered;
	}

	/**
	 * @param reportDecisionTableRendered the reportDecisionTableRendered to set
	 */
	public void setReportDecisionTableRendered(Boolean reportDecisionTableRendered) {
		this.reportDecisionTableRendered = reportDecisionTableRendered;
	}

	/**
	 * @return the competitorList
	 */
	public List<User> getCompetitorList() {
		return competitorList;
	}

	/**
	 * @param competitorList the competitorList to set
	 */
	public void setCompetitorList(List<User> competitorList) {
		this.competitorList = competitorList;
	}

	/**
	 * @return the selectedCompetitorID
	 */
	public Integer getSelectedCompetitorID() {
		return selectedCompetitorID;
	}

	/**
	 * @param selectedCompetitorID the selectedCompetitorID to set
	 */
	public void setSelectedCompetitorID(Integer selectedCompetitorID) {
		this.selectedCompetitorID = selectedCompetitorID;
	}

	/**
	 * @return the spying
	 */
	public Boolean getSpying() {
		return spying;
	}

	/**
	 * @param spying the spying to set
	 */
	public void setSpying(Boolean spying) {
		this.spying = spying;
	}

	/**
	 * @return the startBudget
	 */
	public Double getStartBudget() {
		return startBudget;
	}

	/**
	 * @param startBudget the startBudget to set
	 */
	public void setStartBudget(Double startBudget) {
		this.startBudget = startBudget;
	}

	/**
	 * @return the maxMarketing
	 */
	public Double getMaxMarketing() {
		return maxMarketing;
	}

	/**
	 * @param maxMarketing the maxMarketing to set
	 */
	public void setMaxMarketing(Double maxMarketing) {
		this.maxMarketing = maxMarketing;
	}

	/**
	 * @return the maxPersonal
	 */
	public Double getMaxPersonal() {
		return maxPersonal;
	}

	/**
	 * @param maxPersonal the maxPersonal to set
	 */
	public void setMaxPersonal(Double maxPersonal) {
		this.maxPersonal = maxPersonal;
	}

	/**
	 * @return the maxRD
	 */
	public Double getMaxRD() {
		return maxRD;
	}

	/**
	 * @param maxRD the maxRD to set
	 */
	public void setMaxRD(Double maxRD) {
		this.maxRD = maxRD;
	}

	/**
	 * @return the sellingPrice
	 */
	public Double getSellingPrice() {
		return sellingPrice;
	}

	/**
	 * @param sellingPrice the sellingPrice to set
	 */
	public void setSellingPrice(Double sellingPrice) {
		this.sellingPrice = sellingPrice;
	}
	
}
